import Link from "next/link";
// import { usePathname } from "next/navigation";
import clsx from 'clsx';
import styles from "./layout.module.css";

import { getHome,postUser } from '@/api/home';

const menu = [
    {name:'首页',path:'/',icon:'HomeIcon'},
    {name:'内容',path:'/article',icon:'DocumentDuplicateIcon'},
    {name:'关于',path:'/about',icon:'UserGroupIcon'},
];


export default async function  HeadNav(){
    // const pathname = usePathname();
    const gg = await getHome({id:1,page:2});//get
    console.log(gg,"get请求结果");
    const ggs = await postUser({id:1,name:'张三',sex:'男'}); //post
    console.log(ggs,"post请求结果");

    return (
        <div className={styles.menuBox}>
        {
            menu.map((tab) => {
                const LinkIcon = tab.icon;
                return(
                    <Link key={tab.name} href={tab.path}>
                    <p className="hidden md:block">{tab.name}</p>
                    </Link>
                )
            })
        }
        <div>{ gg.data.name }</div>
        </div>
    )

}